API Documentation
Public Member Functions | List of all members
nkAstraeus::ComplexEffectManager Class Referencefinal

Manages the complex effects available in the component. More...

Inheritance diagram for nkAstraeus::ComplexEffectManager:

Public Member Functions

ComplexEffectcreateOrRetrieve (const nkMemory::StringView &name, COMPLEX_EFFECT_TYPE type)
 
ComplexEffectget (const nkMemory::StringView &name)
 
ComplexEffectgetByIndex (unsigned int id)
 
void rename (const nkMemory::StringView &currentName, const nkMemory::StringView &newName)
 
void erase (const nkMemory::StringView &name)
 

Detailed Description

Manages the complex effects available in the component.

At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.

Member Function Documentation

◆ createOrRetrieve()

ComplexEffect* nkAstraeus::ComplexEffectManager::createOrRetrieve ( const nkMemory::StringView name,
COMPLEX_EFFECT_TYPE  type 
)

Creates if unavailable, or retrieves if available, a complex effect.

Depending on the parameter given for the type, the ComplexEffect instance retrieved will be :

ValuePointer type
EFFECT_TYPE::BLURBlurComplexEffect
EFFECT_TYPE::DOFDofComplexEffect

To address it fully, casting is required. For instance :

BlurComplexEffect* effect = (BlurComplexEffect*)ComplexEffectManager::getInstance()->createOrRetrieve("effect", COMPLEX_EFFECT_TYPE::BLUR) ;
Parameters
nameThe name of the complex effect to retrieve.
typeThe complex effect type to create.
Returns
The complex effect requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

◆ get()

ComplexEffect* nkAstraeus::ComplexEffectManager::get ( const nkMemory::StringView name)

Retrieves a complex effect.

Parameters
nameThe name of the complex effect to retrieve.
Returns
The complex effect if available, nullptr else.

◆ getByIndex()

ComplexEffect* nkAstraeus::ComplexEffectManager::getByIndex ( unsigned int  id)

Get a complex effect, by index. Note that one index can map to a different effect after memory is changed. Useful to loop over all available effects in one go.

Parameters
idThe index of the complex effect to retrieve.
Returns
The complex effect linked if available, nullptr else.

◆ rename()

void nkAstraeus::ComplexEffectManager::rename ( const nkMemory::StringView currentName,
const nkMemory::StringView newName 
)

Renames a complex effect.

Parameters
currentNameThe name of the complex effect to rename.
newNameThe name to reassign to the complex effect.

◆ erase()

void nkAstraeus::ComplexEffectManager::erase ( const nkMemory::StringView name)

Erases and frees a complex effect.

Parameters
nameThe name of the complex effect to erase.

The documentation for this class was generated from the following file: